package jsyf.oa.service.attach;

import jsyf.oa.dao.attach.AttachDao;
import jsyf.oa.entity.attach.AttachmentEntity;
import jsyf.oa.facade.attach.AttachFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Created by Administrator on 2017/12/13 0013.
 */
@Service
@Transactional(rollbackFor = Exception.class)
@com.alibaba.dubbo.config.annotation.Service(protocol = {"dubbo"})
public class AttachService implements AttachFacade {
    @Autowired
    private AttachDao dao;


    @Override
    public String save(String url,String name,String extension,String size) {
        AttachmentEntity attachment=new AttachmentEntity();
        attachment.setUrl(url);
        attachment.setName(name);
        attachment.setExtension(extension);
        attachment.setFileSize(size);
        attachment.setFileType("1");
        attachment.setDelFlag(1);
        dao.add(attachment);
        return attachment.getId();
    }
}
